/**
 * Created by Administrator on 2016/4/26.
 */
(function () {
    var app = angular.module("Form1",["form1_add", "ngResource"]);
    app.controller("controlWarrior", ['$scope','GetData', function ($scope, GetData) {
        $scope.cards = GetData.query();
    }]);

    // 自定义标签: 表格
    app.directive("cardTable", function () {
        return {
            restrict: 'E',
            templateUrl: 'card-table.html'
        };
    });

    // 使用Factory创建一个service
    app.factory('GetData', ['$resource',function GetDataFactory($resource) {
        return $resource('../json/card.json', {}, {});
    }])

    // 使用Provider创建一个可以配置的service
    /*app.provider('GetData', function GetDataProvider($resource) {
        var url = '../json/card.json';

        this.setURL = function (_url) {
            url = _url;
        }

        this.$get = function ($http) {
            return function () {
                return $http.get(url);
            };
        }
    });*/

    // 配置GET DATA这个Service
    /*app.config(function (GetDataProvider) {
        GetDataProvider.setURL('../json/card2.json');
    });*/
})();